package com.byq.mm.common.engine.listener;

import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Stanza;


import com.byq.mm.common.engine.Environment;
import com.byq.mm.common.engine.listener.filter.AbstractFilter;
import com.byq.mm.common.engine.listener.filter.DeviceDefinationFilter;
import com.byq.mm.common.engine.listener.filter.InteractionFilter;
import com.byq.mm.common.engine.listener.filter.MessageFilter;

public class MessageListener  extends AbstractListener implements org.jivesoftware.smack.StanzaListener {
	AbstractFilter filter;
	public MessageListener(Environment e) {
		super(e);
		filter = new MessageFilter(null,e);
		filter = new InteractionFilter(filter,e);
		filter = new DeviceDefinationFilter(filter, e);
	}

	@Override
	public void processPacket(Stanza s) {

		Message msg = (Message) s;
		filter.process(msg);
	}
}
